/**
 * Created by zhongb on 2017/4/11.
 */
var $ = require('jquery');
require('easyui');
var $alert = require('libs/alert');
$(function () {
    //获取url参数
    var entId = $.getUrlParam("id");
    fillData(entId);
    function fillData(entId) {
        $.get('api/v1/p/crm/enterpriseInfo/load',{id: entId},function (res) {
            if(res.code == 200){
                var data = res.data;
                var $firstTarget = $("#entInfo").find("span");
                var $secondTarget = $("#clientInfo").find("span");
                var $thirdTarget = $('#uploadInfo');
                //元素赋值
                $firstTarget.eq(0).text(data.linkMan);
                $firstTarget.eq(1).text(data.linkPhone);
                $firstTarget.eq(2).text(data.linkTel);
                $firstTarget.eq(3).text(data.country);
                $firstTarget.eq(4).text(data.province+" "+data.city+" "+data.area);
                $firstTarget.eq(5).text(data.address);
                $firstTarget.eq(6).text(data.zipcode);
                $secondTarget.eq(0).text(data.type == 'E'?'企业客户':'个人客户');
                $secondTarget.eq(1).text(data.name);
                $secondTarget.eq(2).text(data.linkmanDuty);
                $secondTarget.eq(3).text(data.qq);
                $secondTarget.eq(4).text(data.email);
                $secondTarget.eq(5).text(data.fax);
                $secondTarget.eq(6).text(data.emergencyLinkMan);
                $secondTarget.eq(7).text(data.emergencyLinkTel);
                $secondTarget.eq(8).text(data.saleEmail);
                $secondTarget.eq(9).text(data.timeZone);
                $thirdTarget.find('span').eq(0).text(data.busiLicense);
                $thirdTarget.find('img').eq(0).attr('src',data.enterPics[0].filePath);
            }else{
                $alert(res.message);
            }
        });
    }
});
